cmake_minimum_required(VERSION 3.16)
project(my_oj)

set(CMAKE_CXX_STANDARD 17)

link_directories(${CMAKE_SOURCE_DIR}/lib)
link_directories(/usr/local/lib)

include_directories(/usr/local/include/mongocxx/v_noabi
        /usr/local/include/libmongoc-1.0)
include_directories(/usr/local/include/bsoncxx/v_noabi
        /usr/local/include/libbson-1.0)
include_directories(./include)

aux_source_directory(./src SRCS)

add_executable(oj ${SRCS})

#CMake的链接顺序遵循"被依赖的库放在依赖它的库后面"的原则
#redis++依赖pthread
target_link_libraries(oj jsoncpp mongocxx bsoncxx judger hiredis redis++ pthread)

#release版本
set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall -std=c++17")
#debug版本
set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -g -O0 -Wall -std=c++17")
